/* eslint valid-jsdoc: "off" */

'use strict';

/**
 * @param {Egg.EggAppInfo} appInfo app info
 */
module.exports = appInfo => {
	/**
	 * built-in config
	 * @type {Egg.EggAppConfig}
	 **/
	const config = exports = {};

	// use for cookie sign key, should change to your own and keep security
	config.keys = appInfo.name + '_1698025862990_7574';

	// add your middleware config here
	config.middleware = [];

	// add your user config here
	const userConfig = {
		// myAppName: 'egg',
	};
	// 关闭POST请求的安全验证
	config.security = {
		csrf: {
			enable: false,
			ignoreJSON: true,
		}
	}
	// session配置 1天过期
	config.session = {
		key: 'EGG_SESS',
		maxAge: 10 * 24 * 3600 * 1000,
		httpOnly: true,
		encrypt: true,
	};

	config.mysql = {
		// 单数据库信息配置
		client: {
			// host
			host: '127.0.0.1',
			// 端口号
			port: '3306',
			// 用户名
			user: 'root',
			// 密码
			password: 'root',
			// 数据库名
			// database: 'flowers',
			database: 'flower',
		},
		// 是否加载到 app 上，默认开启
		app: true,
		// 是否加载到 agent 上，默认关闭
		agent: false,
	};
	// 上传文件的配置
	config.multipart = {
		mode: 'file',
	};
	// 默认进入public
	// config.static = {
	// 	prefix: '/',
	// 	dir: appInfo.baseDir + '/public',
	// };

	return {
		...config,
		...userConfig,
	};
};